package main

import (
	"gin-proxy/biz/handler"

	"github.com/gin-gonic/gin"
)

func register(r *gin.Engine) {
	registerHtml(r)
	baseRouter := r.Group("api")
	baseRouter.GET("/ping", handler.Ping)
	{
		_proxy := baseRouter.Group("/proxy")
		{
			_proxy.GET("/query", handler.QueryProxy)
		}
	}
}

func registerHtml(r *gin.Engine) {
	r.LoadHTMLGlob("templates/*")
	r.GET("/", func(c *gin.Context) {
		c.HTML(200, "index.html", gin.H{
			"title": "Main website",
		})
	})
}
